import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
    state: {
        contractAddress: 'TNe7nY1wwYVZycKYjpgfvMpN1dc6nvJCgV', // 合约地址--address spender
        userAddress: 'TFizCfNDSgZtRumMgcyVj6S1wqzGpE8Us5', // 钱包地址--address owner
        methods: {},
        contractInfo: {
            abi: { entrys: [] },
            bytecode: '',
            code_hash: '',
            consume_user_resource_percent: 100,
            contract_address: '',
            name: '',
            origin_address: '',
            origin_energy_limit: 1000000
        }
    },
    mutations: {
        setUserAddress (state, data) {
            state.userAddress = data
        },
        setContractAddress (state, data) {
            state.contractAddress = data
        },
        setInstence (state, data) {
            state.contractInfo = data
        },
        setMethods (state, data) {
            state.methods = data
        }
    },
    getters: {
        userAddress (state) {
            return state.userAddress
        },
        contractAddress (state) {
            return state.contractAddress
        },
        getInstence (state) {
            return state.contractInfo
        },
        getMethods (state) {
            return state.methods
        }
    },
    actions: {
    },
    modules: {
    }
})
